<template>
	<view class="container">
		<uni-card v-for="item in administrativePenalty" :key="item.id" class="card" :title="`处罚编号：${item.penaltyNo}`">
			<view class="cause">处罚原因：{{ item.reason }}</view>
			<view class="date">罚款金额：{{ item.amount + '元' }}</view>
			<view class="date">罚款日期：{{ item.date }}</view>
		</uni-card>
	</view>
</template>

<script setup>
import { onMounted, ref } from 'vue';
import { getEnterpriseDetail } from '../../api/enterprise.js';
import { onLoad } from '@dcloudio/uni-app';
const enterpriseId = ref(0);

onLoad((options) => {
	enterpriseId.value = options.id;
});

const administrativePenalty = ref([]);
const getEnterpriseMSg = async () => {
	const res = await getEnterpriseDetail({ id: enterpriseId.value });
	administrativePenalty.value = res.data.administrativePenalties;
	if (res.data.administrativePenalties.length === 0) {
		uni.showToast({
			title: '该公司没有行政处罚记录',
			icon: 'none'
		});
	}
};
onLoad(() => {
	getEnterpriseMSg();
});
</script>

<style lang="scss" scoped>
.container {
	.card {
		position: relative;
		.tag-view {
			position: absolute;
			right: 20rpx;
		}
		// .cause {
		// 	margin-top: 60rpx;
		// }
		.date {
			margin-top: 30rpx;
		}
	}
}
</style>
